function RefRate()
{
	$.getJSON("op.php?op=xml_3d&fp=rate_3d&playtype="+playtype+"&lotto_id_3d="+lotto_id+"&gametype="+gametype+"&disk="+$("#select_disk").val(),null,function(r){
		switch(playtype)
		{
			case "r1":
				for(i=0;i<=9;i++)
				{
					ChangeRate("rr55_"+i,r.r55_0.rates[i]);	
				}
				var nameA=[56,57,58,59,60,61,4,7,10,5,8,11,6,9,12,71,72,73];
				for(i=0;i<nameA.length;i++)
				{
					ChangeRate("rr"+nameA[i]+"_1",r["r"+nameA[i]+"_0"].rates[0]);	
					ChangeRate("rr"+nameA[i]+"_2",r["r"+nameA[i]+"_0"].rates[1]);
				}
				ChangeRate("rr73_3",r["r73_0"].rates[2]);
				break;	
			case "r2":
				var nameA=[1,2,3,69,70];
				for(i=0;i<nameA.length;i++)
				{
					for(k=0;k<=9;k++)
					ChangeRate("rr"+nameA[i]+"_"+k,r["r"+nameA[i]+"_0"].rates[k]);	
				}
				break;
			case "r3":
				for(i=0;i<=9;i++)
					ChangeRate("rr55_"+i,r.r55_0.rates[i]);	
				for(i=0;i<=9;i++)
					ChangeRate("rr0V2_"+i,r.r0_2.rates[i]);	
				for(i=0;i<=9;i++)
					ChangeRate("rr0V1_"+i,r.r0_1.rates[i]);
				for(i=0;i<=9;i++)
					ChangeRate("rr0V0_"+i,r.r0_0.rates[i]);

				for(i=0;i<=4;i++)
					ChangeRate("rr76V2_"+i,r.r76_2.rates[i]);	
				for(i=0;i<=4;i++)
					ChangeRate("rr76V1_"+i,r.r76_1.rates[i]);
				for(i=0;i<=4;i++)
					ChangeRate("rr76V0_"+i,r.r76_0.rates[i]);
				break;
			case "r4":
				for(i=0;i<=14;i++)
					ChangeRate("rr74_"+i,r.r74_0.rates[i]);	
				for(i=0;i<=8;i++)
					ChangeRate("rr75_"+i,r.r75_0.rates[i]);	
				break;
		}
		
		window.setTimeout("ClearColor()",1000);
	});	
	$("td[ksel=true] input").bind("click",function(b){
			var obj=$(this);
			var obj2=$(this).parent().parent().next();//
			var obj3=(playtype=="r1"?obj2.next():obj2);
			switch(obj.index())
			{
				case 0: //大
					if(playtype=="r1")
						obj2.next().next().find("input").addClass("selcolor");
					else
						obj2.next().find("input").addClass("selcolor");
					break;	
				case 1: //小
					if(playtype=="r1")
						obj2.next().find("input").addClass("selcolor");
					else
						obj2.find("input").addClass("selcolor");
					break;
				case 2: //單
					obj3.find("input").each(function(index, element) {
						var p=element.name.split("_");
						if(p[1]%2==1)
                    		$(element).addClass("selcolor");	    
                    });
					obj3.next().find("input").each(function(index, element) {
						var p=element.name.split("_");
						if(p[1]%2==1)
                    		$(element).addClass("selcolor");	    
                    });
					break;
				case 3: //双
					obj3.find("input").each(function(index, element) {
						var p=element.name.split("_");
						if(p[1]%2==0)
                    		$(element).addClass("selcolor");	    
                    });
					obj3.next().find("input").each(function(index, element) {
						var p=element.name.split("_");
						if(p[1]%2==0)
                    		$(element).addClass("selcolor");	    
                    });
					break
				case 4: //质
					obj3.find("input").each(function(index, element) {
						if(index>=1 && index<=3)
                    		$(element).addClass("selcolor");	    
                    });
					obj3.next().find("input").each(function(index, element) {
						if(index==0 || index==2)
                    		$(element).addClass("selcolor");	    
                    });
					break;
				case 5: //合
					obj3.find("input").each(function(index, element) {
						if(!(index>=1 && index<=3))
                    		$(element).addClass("selcolor");	    
                    });
					obj3.next().find("input").each(function(index, element) {
						if(index!=0 && index!=2)
                    		$(element).addClass("selcolor");	    
                    });
					break;
				case 6: //取消
					$(this).parent().parent().parent().find(".selcolor").removeClass("selcolor");
					break;
			}
		});
}